package org.lanqiao.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.lanqiao.entity.Music;
import org.lanqiao.service.Musicservice;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;

@Controller
@RequestMapping("/entertain")
public class MusicController {
	@Resource
	Musicservice musicservice;
	//首页
	@RequestMapping("/index.do")
	public String index() {
		return "index";
	}
	
	//视频  http://localhost:8887/entertainment/musicbox.do
	@RequestMapping("/musicbox.do")
	public String musicbox() {
		return "musicbox";
	}
	
	//获取全部的歌曲
	@RequestMapping("/findMusic.do")
	public String findMusic(HttpServletRequest request ,String title,@RequestParam(name="pageNum",required=false,defaultValue="1") int pageNum){
		PageInfo<Music> ls = musicservice.selectmusics(new Music(title),pageNum,7);
		request.setAttribute("PageInfo", ls);
		return "show";
		
	}
	
}
